<!-- partial-home.html -->

<div class="">

    <div class="row" style="margin-top: 10px;margin-left: 50px">

        <div class="col-lg-6 col-md-6 col-sm-6" >
            <button type="button" class="btn btn-blue btn-outlined btn-md" ng-click="showAddOne=true">
                <span class="glyphicon glyphicon-plus"></span>创建培训班期
            </button>
        </div>

    </div>


    <!-- 添加区域 -->
    <div class="row"
         style="border: 1px solid #B9D4E4;margin:10px;padding: 10px;max-width: 1000px"
         ng-if="showAddOne">
        <br>
        <div class="col-lg-6 col-md-6 col-sm-6">


            班期  <input  class="form-control"
                          placeholder=""  ng-model="addEditData.name">
            描述<textarea  class="form-control"
                         placeholder=""  ng-model="addEditData.desc"> </textarea>

        </div>

        <div class="col-lg-6 col-md-6 col-sm-6">

            展示次序<input  class="form-control"
                        placeholder=""  ng-model="addEditData.display_idx">

            <br>
            所属培训班
            <select style='min-width: 200px;' ng-model="$parent.addEditData.training_id"
                            ng-options="training.id as training.name for training in trainingList">
            </select>



        </div>

        <div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 20px">
            <button type="button" class="btn btn-green btn-outlined btn-xs" ng-click="addOne()" >
                确定</button>
            <button type="button" class="btn btn-green btn-outlined btn-xs" ng-click="$parent.showAddOne=false" >
                取消</button>
        </div>
    </div>

    <br><br>

    <div class="row col-lg-12 col-md-12 col-sm-12"  ng-if="theList.length>0">

        <table class="table table-hover table-striped table-bordered table-advanced tablesorter" >
            <thead>
            <tr>

                <th width="8%" style="text-align:center">次序</th>
                <th width="30%" style="text-align:center">班期</th>
                <th width="30%" style="text-align:center">描述</th>
                <th width="20%" style="text-align:center">所属培训班</th>
                <th width="12%" style="text-align:center">操作</th>
            </tr>
            </thead>

            <tbody>

            <tr dir-paginate="one in theList| itemsPerPage: pageSize" total-items="totalNum" current-page="$parent.currentPage">

                <td style="text-align:center">
                    <span ng-if="!one.editing">{{one.display_idx}}</span>
                    <input ng-if="one.editing" ng-model="addEditData.display_idx"
                           style="max-width: 60px">
                </td>

                <td style="text-align:center">
                    <span ng-if="!one.editing">{{one.name}}</span>
                    <input ng-if="one.editing" ng-model="addEditData.name"
                           style="max-width: 90px">
                </td>
                <td style="text-align:center">
                    <p ng-if="!one.editing">{{one.desc}}</p>
                    <textarea ng-if="one.editing" ng-model="addEditData.desc" ></textarea>
                </td>

                <!--所属培训班-->
                <td style="text-align:center">

                    <span ng-if="!one.editing">{{one.trainingname}}</span>

                    <select ng-if="one.editing" style='min-width: 200px;' ng-model="$parent.addEditData.training_id"
                                ng-options="training.id as training.name  for training in trainingList">
                    </select>

                </td>


                <td style="text-align:center">
                    <button type="button" class="btn btn-green btn-outlined btn-xs"
                            ng-click="editOneBegin(one)" ng-if="!one.editing">
                        编辑
                    </button>
                    <button type="button" class="btn btn-green btn-outlined btn-xs"
                            ng-click="delOne(one)" ng-if="!one.editing">
                        删除
                    </button>
                    <button type="button" class="btn btn-red btn-outlined btn-xs"
                            ng-click="editOneSubmit(one)" ng-if="one.editing">
                        确定</button>
                    <button type="button" class="btn btn-red btn-outlined btn-xs"
                            ng-click="editOneCancel(one)" ng-if="one.editing">
                        取消</button>
                </td>

            </tr>
            </tbody>

        </table>

    </div>

    <div class="note note-success" ng-if="theList.length==0" >
        <h4 class="box-heading">没有查询到培训班信息</h4>
    </div>

    <div class="col-lg-12 col-md-12 col-sm-12 " style="text-align: center;font-family: 'Microsoft YaHei';font-size: medium;">
        <dir-pagination-controls boundary-links="true" on-page-change="pageChangeTo(newPageNumber)"></dir-pagination-controls>
    </div>

</div>
</div>